<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/amazeui.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/admin.css">
    <link rel="stylesheet" href="css/app.css">
    <style>
        .admin-main{
            padding-top: 0px;
        }
    </style>
    <script>
        function checkPwd(){
            var name=document.frm.name.value;
            var area=document.frm.area.value;
            var address=document.frm.address.value;
            var type=document.frm.type.value;
            var point=document.frm.point.value;
            var pointnum=document.frm.pointnum.value;
            var average=document.frm.average.value;

            var datas={};
            datas.name=name;
            datas.area=area;
            datas.address=address;
            datas.type=type;
            datas.point=point;
            datas.pointNum=pointnum;
            datas.average=average;
            $.ajax({
                async:false,
                type: "POST",
                url: "/food/doinsertFood",//注意路径
                data:datas,
                dataType:"json",
                success:function(data){
                    if(data.result=='SUCCESS'){
                        alert("新增成功！");
                        parent.location.reload();
                    }else{
                        alert("新增失败，失败原因【" + data.result + "】");
                    }
                },
                error:function(data){
                    alert(data.result);
                }
            });

            return true;
        }
    </script>
</head>

<body>
<div class="am-cf admin-main">
    <!-- content start -->
    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-g">
                <form class="am-form am-form-horizontal" name="frm"
                      method="post" onsubmit="return checkPwd();"
                      style="padding-top:30px;" data-am-validator>
                    <div class="am-form-group">
                        <label  class="am-u-sm-3 am-form-label" s>
                            店名 </label>
                        <div class="am-u-sm-9">
                            <input  style="display: block;width: 100%;padding: .5em;
    font-size: 1.6rem;
    line-height: 1.2;
    color: #555;
    vertical-align: middle;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ccc;
    border-radius: 0;
    -webkit-appearance: none;
    -webkit-transition: border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;" required placeholder="请输入店名"
                                    name="name">
                        </div>
                    </div>
                    <div class="am-form-group">
                        <label  class="am-u-sm-3 am-form-label" s>
                            地区 </label>
                        <div class="am-u-sm-9">

                            <select style="display: block;width: 100%;padding: .5em;
    font-size: 1.6rem;
    line-height: 1.2;
    color: #555;
    vertical-align: middle;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ccc;
    border-radius: 0;
    -webkit-appearance: none;
    -webkit-transition: border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;" name="area" required >
                                <c:forEach items="${area}" var="area">
                                    <option value="${area.area}">${area.area}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                    <div class="am-form-group">
                        <label  class="am-u-sm-3 am-form-label" s>
                            地址 </label>
                        <div class="am-u-sm-9">
                            <input   style="display: block;width: 100%;padding: .5em;
    font-size: 1.6rem;
    line-height: 1.2;
    color: #555;
    vertical-align: middle;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ccc;
    border-radius: 0;
    -webkit-appearance: none;
    -webkit-transition: border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;" required placeholder="请输入详细地址"
                                    name="address">
                        </div>
                    </div>
                    <div class="am-form-group">
                        <label  class="am-u-sm-3 am-form-label" s>
                            类型 </label>
                        <div class="am-u-sm-9">
                            <select style="display: block;width: 100%;padding: .5em;
    font-size: 1.6rem;
    line-height: 1.2;
    color: #555;
    vertical-align: middle;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ccc;
    border-radius: 0;
    -webkit-appearance: none;
    -webkit-transition: border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;" name="type" required >
                                <c:forEach items="${type}" var="type">
                                    <option value="${type.type}">${type.type}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                    <div class="am-form-group">
                        <label  class="am-u-sm-3 am-form-label" s>
                            评分 </label>
                        <div class="am-u-sm-9">
                            <input   style="display: block;width: 100%;padding: .5em;
    font-size: 1.6rem;
    line-height: 1.2;
    color: #555;
    vertical-align: middle;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ccc;
    border-radius: 0;
    -webkit-appearance: none;
    -webkit-transition: border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;" required placeholder="请输入评分"
                                    name="point" type="number" oninput="if (value>5)value=5;if (value<0)value=0">
                        </div>
                    </div>
                    <div class="am-form-group">
                        <label  class="am-u-sm-3 am-form-label" s>
                           人气 </label>
                        <div class="am-u-sm-9">
                            <input   style="display: block;width: 100%;padding: .5em;
    font-size: 1.6rem;
    line-height: 1.2;
    color: #555;
    vertical-align: middle;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ccc;
    border-radius: 0;
    -webkit-appearance: none;
    -webkit-transition: border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;" required placeholder="请输入人气"
                                    name="pointnum" type="number" oninput="if (value<0)value=0">
                        </div>
                    </div>
                    <div class="am-form-group">
                        <label  class="am-u-sm-3 am-form-label" s>
                            人均消费 </label>
                        <div class="am-u-sm-9">
                            <input   style="display: block;width: 100%;padding: .5em;
    font-size: 1.6rem;
    line-height: 1.2;
    color: #555;
    vertical-align: middle;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ccc;
    border-radius: 0;
    -webkit-appearance: none;
    -webkit-transition: border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;" required placeholder="请输入人均消费"
                                    name="average" type="number" oninput="if (value<0)value=0">
                        </div>
                    </div>
                    <label class="am-u-sm-3 am-form-label" style="color:red;">${sessionScope.food_err}</label>
                    <div class="am-form-group">
                        <div class="am-u-sm-9 am-u-sm-push-3">
                            <input type="submit" class="am-btn am-btn-success" value="新增美食" />
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript"
        src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js">
</script>
<script type="text/javascript" src="${pageContext.request.contextPath}/myplugs/js/plugs.js">
</script>
</body>
</html>
